# 学习Matplotlib  p9.1.1.1

#%%
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns

# seaborn.set()

#%%
with sns.axes_style("whitegrid"):
    fig, axes = plt.subplots(2, 2, sharex=True,
                            sharey=True)  # sharex sharey  子图是否共享x,y轴
    for i in range(2):
        for j in range(2):
            axes[i, j].hist(np.random.randn(500), bins=50, color='k', alpha=0.5)
    plt.subplots_adjust(wspace=0, hspace=0)

# %%
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
ax.plot(np.random.randn(1000).cumsum())  #cumsum  累计和

ticks = ax.set_xticks([0, 250, 500, 750, 1000])
labels = ax.set_xticklabels(['one', 'two', 'three', 'four', 'five'],
                            rotation=30,
                            fontsize='small')  # fonsize 字形大小
props = {
    'title': 'My first matplotlib plot',
    'xlabel': 'Stages'}
ax.set(**props)
ax.text(0,0,'Hello world',family='monspace',fontsize=10)

# %%
a = pd.DataFrame(np.random.randn(100,4))
sns.regplot(x=0,y=1,data=a)
plt.show()
# %%

# %%
